#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e6+100;
typedef long long LL;
const LL mod=998244353;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL a[maxn];
LL ans[maxn];
LL sum[maxn];
LL fac[maxn];
///1,2,9,56,395,3084,26621
///1 2 3 4   5    6    7
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL n;cin>>n;
  fac[0]=1;
  for(LL i=1;i<maxn-1;i++) fac[i]=fac[i-1]*i%mod;
  a[0]=a[1]=0;
  for(LL i=2;i<=n;i++) a[i]=((a[i-1]+1)%mod*i%mod)%mod;
  cout<<(n%mod*fac[n]%mod-a[n]%mod+mod)%mod<<"\n";
  /*
  fac[0]=1;
  for(LL i=1;i<20;i++) fac[i]=fac[i-1]*i;
  LL tot=0;
  for(LL i=1;i<=n;i++) a[i]=i;
  do{
    for(LL i=1;i<=n;i++) ans[++tot]=a[i];
  }while(next_permutation(a+1,a+1+n));
  for(LL i=1;i<=tot;i++){
    sum[i]=sum[i-1]+ans[i];
  }
  LL res=0;
  for(LL i=1;i<=tot;i++){
     if(sum[i+n-1]-sum[i-1]==n*(n+1)/2){
            res++;
        }
  }
  cout<<"\n";
  cout<<n*fac[n]-res<<"\n";*/
return 0;
}
